﻿Namespace EIBData
    Public Class EIBDataEIS_Info

        Sub New(Name As String, OctetLength As Byte, Type As Type)
            _EIS_Name = Name
            _EIS_OctetLength = OctetLength
            _EIS_Type = Type
        End Sub


        Private _EIS_Name As String = ""
        Public ReadOnly Property EIS_Name As String
            Get
                Return _EIS_Name
            End Get
        End Property

        Private _EIS_OctetLength As Byte = 0
        Public ReadOnly Property EIS_OctetLength As Byte
            Get
                Return _EIS_OctetLength
            End Get
        End Property

        Private _EIS_Type As Type = Nothing
        Public ReadOnly Property EIS_Type As Type
            Get
                Return _EIS_Type
            End Get
        End Property


        Public Shared Function GetEISBases() As List(Of EIBDataEIS_Info)
            Dim l As New List(Of EIBDataEIS_Info)

            For Each t In System.Reflection.Assembly.GetAssembly(GetType(EIS.EIBDataEIS_Base)).GetTypes
                If t.IsSubclassOf(GetType(EIS.EIBDataEIS_Base)) Then
                    If Not t.IsAbstract Then
                        l.Add(New EIBDataEIS_Info(t.GetProperty("EIS_Name").GetValue(Nothing, Nothing),
                                                  t.GetProperty("EIS_OctetLength").GetValue(Nothing, Nothing),
                                                  t))
                    End If
                End If
            Next

            Return l
        End Function
    End Class
End Namespace